<?php session_start();?>
<?php include_once"../Backend/Eventlog.php";?>
<?php include_once"../Backend/Session.php";?>
<!DOCTYPE HTML>

<html>
 <head>

  <title>My Practice HTML Page</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link href="Test.css" rel="stylesheet" type="text/css">
  <meta name="dcterms.Type"          content="Text" />
  <meta name="dcterms.publisher"     content="Marc" />
  <meta name="dcterms.subject"       content="Dublin Core Metadaten-Elemente, Anwendungen" />
  <meta name="dcterms.creator"       content="Marc" />
  <meta name="dcterms.title"         content="Pubvat" />
  <meta name="dcterms.keywords"      content="Kalender" />
  <meta name="dcterms.desciption"    content="Ein Kalender" />
  <meta name="dcterms.contributor"   content="User" />
  <meta name="dcterms.date"          content="2011-12-02"/>
  <meta name="dcterms.format"        content="Kalender"/>
  <meta name="dcterms.identifier"    content="https://pc-martin.it.fh-worms.de:4433/swa20/frontend/Startseite.html" />
  <meta name="dcterms.source"        content="??"/>
  <meta name="dcterms.language"      content="de"/>
  <meta name="dcterms.relation"      content="http://www.google.de"/>
  <meta name="dcterms.coverage"      content="Deutschland"/>
  <meta name="dcterms.rights"        content="www.google.de"/>



</head>

<body id="main">
	<div id="menu">
   	<p> <font size = "7" >LOGO </font></p>
   	&nbsp;

  	</div>


	<div id="navigation">
  		<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
			<h2>Log In</h2>
			Your email address
			<input type="text" name="login" id="LoginControl" class="textCtrl" tabindex="1"><br>
			Your password<br>
			<input type="password" name="password" class="textCtrl" id="ctrl_password" tabindex="2"><br>
			<input type="submit" name ="send" class="button primary" value="Log in" tabindex="3" data-loginphrase="Log in" data-signupphrase="Sign Up">
		</form>
		<?php
			if(isset($_POST["login"],$_POST["password"])){
				$email = $_POST["login"];
				$pass = $_POST["password"];
				Eventlog::writeEventlog("Login-Try as: ".$email);
				Eventlog::writeEventlog("with password: ".$pass);
				
				$session = new Session();
				// 0 incorrect, 1 correct
				switch($session->login($email, $pass)){
					case 0:
						echo "Login-Data incorrect. Please register yourself!<br>";
						break;
					case 1:
						$_SESSION['password'] = $pass;
						$_SESSION['email'] = $email;
						header('Location: Folgeseite.php');
						break;
					default:
						;
				}
				
				
			}
		?>
		<a href="http://www.google.de" name="forgotPassword">forgot password?</a><br>
		<a href="Register.php" name="register">Register...</a>
	</div>



	<div id="centerDoc">
        <table>
        	<caption></caption>
        	<tr><th><h1>Main Area</h1></th></tr>

            <tr ><td>
            	<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean
	            massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis,
	            ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla
	            vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam
	            dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean
	            vulputate eleifend tellus.
	            </p>
	            <p>Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem
	             ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque
	             rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.
	              Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing
	              sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et
	               ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci
	                eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed
	                 consequat, leo eget bibendum sodales, augue velit cursus nunc,
	            </p>
			</td></tr>

            <tr><td id="test"><div><input type="text" name="publicSearch" id="publicSearch" placeholder="&Ouml;ffentliche Kalender durchsuchen"><br>
      		<input type="button" name"publicSearchButton" id="publicSearchButton" value="Suchen">  </div></td></tr>
        </table>

  </div>

 </body>

</html>